Extract waiting logic to external class