Refactor rarch_main_init