Headers parser refactor

Finished it and half the tests.

Please check my comments on the diff for a few of my questions.