JS code tidying
Closured the js file as well as tidied up some code
Small tweaks for better results from the closure compiler