Cleaned up structure

Moved js to a new file to get it out of index.html