Use task.flatten instead of reinventing the wheel. Thank you @miku