code reorg for js consolidation