Cache hostname and multiple urls under a single hostname.
clean up and add some function headers