all tests pass for wait_for too
refactoring