Fixed a problem with the JS

Got it basically working.