renaming wait function