changed delay() to usleep()