[WIP] Continued JS refactor