Redesigned JS to modular