change parenting() function to wait() function