main js cleanup for performance