Pull out this map setup code, it is repeated multiple times.