Small refactors to hooks.rb