Change header map slightly to allow code to be inlined
Move some of the lesser used logic out of the main event method on the listener
Simplify response content encoding selection logic