refactored recursive mapping of maps