Moved all js code to a seperate file