added wait for success and refactored wait for so that it uses wait for success