Added small optimization for queues