I got it all to work in the end.
I think it wasn't working because one of the lines I'd commented out hadn't been fully commented out so there was half a line of PHP causing an error, which just seemed to stop the hook from being run whilst everything else carried on regardless. I knew it would end up being something silly.
If this should have produced an error message somewhere let me know so I'll know next time
thanks
kirsty