i) tidy up code and add some comment into hooks.mk
ii) removed test code from sample and left a working sample