Nowhere near complete, but successful extracting headers
a bunch of comments explaining the strategy used