This is a bit messy. How about keeping track of the current queue number as you enumerate the list, and then resetting all subsequent queues if you find one has been removed?