Adding a hash method to sort recursively by keys