changed sum to mean