switched sleep statements to use waitFor custom closure