Solution to hash_inject