Start refactoring JS