support arbitrary number of queues