refactor header parser