Refactored header functionality into directive.