extract map_type functionality into separate file (it took up too much space)