Code refactored to only return 1 dict.