Fix Bug 965501, use flex for moar header awesomeness

@erikrose r? A little welcome home present ;) An look at all the code we can remove. Flex FTW!