Change thread.sleep to task.delay per best practice