clean up the http handler a bit