Now checks that the queue contains items before inserting them.