added waitFor function