refactoring main_arr