General JS Fixes

* Reduced filesize
* General code maintenance