[Refactor] Minor reorganization of mod_main.js