refactors js