cleaned JS code