Looking back at this, I agree that it should be modified to just sort upon add. That will reduce complexity.