declaration for wait added.