Simple form with one subform repeating. Subform contains an increasing index number with each instance. Add button works as anticipated. Remove button removes the first instance added rather than the last instance added and subsequently the index numbers are out of order.
Is the problem with remove button or the "instanceIndex" code?