Added methods for registering hooked commands.
Minor changes to hooking functions.
Added hook calls to startup and shutdown.