add total_time and solve flight loop