Refactor header creation.