add totaling functionality