optimize queues : from Nat Goodspeed