Develop run_task function