clean up JavaScript code

* remove commented code
* remove unused code
* remove debug outputs