Cleanup JS code