sum and normalize functions added