move wait to method