Started refactoring js several years old