added wait option