more cleanup of map code