wait needs some refinement