Clean up create_task method - get rid of ugly conditional