cleanup js, refactored js to blocal