                     return 'distance'
         return 'unknown'
 
-    modelsToExportSpecification = (models) =>
-        { selectedUnits, selectedServices, searchResults, units, divisions } = models
-        key = modelsToSelectionType models
+    modelsToExportSpecification = (appModels) =>
+        { selectedUnits, selectedServices, searchResults, units, divisions } = appModels
+        key = modelsToSelectionType appModels
         specs = key: key, size: units.size()
         _.extend specs, switch key
             when 'single'


    models = require 'cs!app/models'

    modelsToSelectionType = (models) =>
        { selectedUnits, selectedServices, searchResults, units } = models

        if selectedUnits.isSet()
            return 'single'

            else
                url: null

    exportSpecification = (format, appModels) =>
        if format not in ['kml', 'json']
            return null
        specs = modelsToExportSpecification appModels
        url = specs.url
        if url
            uri = URI url
