main_logic