Added raw totals and some refactoring.