Add support for headers and clean up code
Merge pull request #6 from wylst/headers

Add support for headers