Added functionality + test for 'hooks' model option
Refactoring a bit