Refactor header parsing to parse as it streams