The source code for hooks when they were initially released was actually really straightforward too. It's been many years since I've read through other parts of the source code though.