make map-formatting function more compact