More cleanup of map building code