move sum out of hash class