simplify the hashify method and add tests