add main_oop for refactoring