trying to get the waitFor() function to work