Small refactoring.
Js refactored to load on specific pages.
Refactoring to keep code in functions.