head refactored