added flow control gates