used usleep instead of sleep