added logic to compute indexes