   #    #############################################
 
   renderVisualization = (scope) ->
+    path = deducePathProjection(scope.projection)
+    renderMap(scope, path)
+
+
     map = scope.map
     data = scope.data
-    path = deducePathProjection(scope.projection)
     valueProperty = scope.valueProperty
     mappingPropertyOnMap = scope.mappingPropertyOnMap
     mappingPropertyOnData = scope.mappingPropertyOnData
-    quantizeSteps = scope.quantizeSteps || defaults.quantizeSteps
-
-    renderMap(scope, map, path)
-
-    bounds =  path.bounds(map)
+
+
+    bounds =  path.bounds(scope.map)
     resizeMap(scope.svg, bounds)
 
     if data
-      allMappingPropertiesOnMap = deduceAllAvailableMappingOnMap(map, mappingPropertyOnMap)
-      valFn = deduceValueFunction(data, valueProperty, quantizeSteps, allMappingPropertiesOnMap, mappingPropertyOnData, scope.mapId)
-      renderData(scope, data, mappingPropertyOnData, valueProperty, mappingPropertyOnMap, valFn)
+      quantizeSteps = scope.quantizeSteps || defaults.quantizeSteps
+      allMappingPropertiesOnMap = deduceAllAvailableMappingOnMap(scope.map, scope.mappingPropertyOnMap)
+      valFn = deduceValueFunction(scope, quantizeSteps, allMappingPropertiesOnMap)
+      renderData(scope, valFn)
       renderLegend(scope, valFn)
 
 



  # either quantize or ordinal depending on type of data
  deduceValueFunction = (data, valueProperty, quantizeSteps, allMappingPropertiesOnMap, mappingPropertyOnData, mapId) ->
    mapInstance = mapMediatorService.getUIModel(mapId)
    if mapInstance.getValueType() == 'categorical'
      categoryValues = mapInstance.getCategoryValues()
      valFn = d3.scale.ordinal()

angular.module('ldEditor').directive 'choropleth', ($timeout, ngProgress, mapMediatorService) ->

  # TODO: once we have initialized everything in the form this can go
  defaults =
    projection: 'mercator'
    quantizeSteps: 9
