Numerous changes and improvements to the http code