reorder output queues and lookup