Refactors js