add wait and memory