indexx set to -1 instead of 0
indexx shouldn't be updated in a switch to index (due to compiler optimization)
So updating the indexx only in perform_operations