reworking tally problems with better abstractions