Added param to handle time to wait