TwoQueues implementation