Adding a totaled() function