Major JS Cleanup

Renamed and condensed JS for easier reading and understanding