remove unused var
simplify summation