Refactor common headers into separate function.