refactor waiting statement