refactor of header and writing a test