added sumfunction