Code review of JS refactor. Also, use Event Mind scaffolding tool to add boilerplate code/structure. For globals acting as singletons, I implemented the JS module pattern.