continuing migrate legacy js code to modular structure