added total calculation