FINISHED indexCalc.R - seems to all work