Refactoring to move js and css out of main page