refactoring hooks and models