Reorganised the init code for the map.