Tidy a bit.
Move the http stuff to a seperate file, move the core http stuff to one function
Log the duration and uid to syslog for tool on and off.