Moved Javascript to templates to reduce number of connections on refresh. Performance gain on site of about 15% with last nights test