refactored custom waits