Updated wait method.