Changed title
Moved JS to a separate file

...and cleaned up some code