Added file naming functions for saving data
Added refIndex and meritFig saving. Changed refIndex subscripts