[Refactor] In-progress: strip down mod_main.js to doing only "essential" work

- Moved stuff from mod_main to mod_basicPageUtils (renamed from mod_utils)
- Plus misc minor refactoring