Moved sum logic from view template to view object.