added support for overriding headers on the server side as well as removed some code i wasn't happy with