Increased performance by always removing the last element of the index vector.