core JS cleanup