update JS code organization