simplified hashing code somewhat, made some of the interface private for testing