Added code for time wait