Moved initHeader logic to directive