to_hash method descends arrays

The to_hash method currently does not descend arrays during conversion, this commit adds code to check for arrays, and then looping/descending further if necessary