pulling inner equation creation out of summation