refactored methods
added wait