Removing some JS debugging statements and cleaning JS code.