Changing detwilify method to work for hashes