* Converted the code to JavaScript. Seems to be working pretty well.
* Also fixed some comments in the PHP