simplify sum func