Changed functions to use map of maps instead of vector of maps.