Moved JavaScript to seperate files