refactoring of header pretty printing