LOTS OF STUFF.

Both those headers were stole from http://github.com/SirCmpwn/mercury.