start refactoring JS code to modules