Removed the duplicated code in run_instances()