finally finished implementing sum