refactored hooks