changed index calculation