Added offset-style weighting and summation.