Remove boilerplate and condense the http handler down to one function.
Also fixed indenting on one line in shell script.