move initial wait before while-loop