Small optimization in the queue
Speed-optimized version of the queue