(Core) Backport - use all of the queue entries; simplify the clear_queue function