Amend the code to not use usleep