Refactor hook callbacks