refactoring wait: timeout to queue