Added better sanity checks

Better checks for config and debug objects
Added hooks support

Created the hooks class