Refactored code that generates headers