Added sum count logic.