refactor hash to not have to cast things to hash item all the time and add some unit tests