Fixed displayIndex initialization