cleanup JS code