further simplified sum_spec.k