added waiting mechanism