Extracted the javascript into a seperate file