fixed incorrect naming and summations; works!