convert main js from object module pattern to more straight-forward module pattern