Added printing and sum functionality