added sub-string summation