It looks like these methods both return hashes, could the return values of these hashes be merged so we don't have to have the outer `each` block and remove a level of indentation?