JS reconfiguration

* contains all of the previous pull request
* js scripts is now included as needed rather than globally