Updates to the tag sum calc, and some refactoring