refactored head class