implement main_solver