Cleaning up JS code.