implement flow control