reduced repeated code in queues