Correct all the errors in the JS
Removed unused stuff