adding up function to other template not very dry