changed nanosleep to waitpid