Moved index calculation into run script so it's saved in config file