refactoring of task_main_window