JS reconfiguration

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