-define ['angular', 'lodash', 'underscore.string', 'scan'], (ng, _, _s) ->
+define ['angular', 'lodash', 'scan', 'modeling', 'helpers'], (ng, _) ->
   session = ng.module(
     'qiprofile.session',
-    ['qiprofile.resources', 'qiprofile.scan', 'qiprofile.helpers']
+    ['qiprofile.resources', 'qiprofile.scan', 'qiprofile.modeling', 'qiprofile.helpers']
   )
 
   session.factory 'Session', [
-    'Resources', 'Scan', 'ObjectHelper',
-    (Resources, Scan, ObjectHelper) ->
-      # Adds the following modeling label map properties:
-      # * parameterResult - the parent parameter result object
-      # * key - the parent parameterResult key
-      #
-      # @param labelMap the object to extend
-      # @param paramResult the parent parameter result
-      extendLabelMap = (labelMap, paramResult) ->
-        labelMap.parameterResult = paramResult
-        Object.defineProperty labelMap, 'key',
-          get: ->
-            @parameterResult.key
-
-      # Adds the following modeling parameter result properties:
-      # * key - the parameter result access property name
-      # * modelingResult - the parent modeling result
-      #   reference
-      # * overlay - the label map, if it exists and has a
-      #   color table
-      #
-      # In addition, if there is a label map, then this function
-      # sets the label map parent modeling parameter reference.
-      #
-      # @param paramResult the object to extend
-      # @param modelingResult the parent modeling result object
-      # @param key the parameter result access property name
-      extendParameterResult = (paramResult, modelingResult, key) ->
-        # The parameter key property identifies the
-        # parameter, e.g. ktrans.
-        paramResult.key = key
-        # Set the parent modeling result reference.
-        paramResult.modelingResult = modelingResult
-        if paramResult.labelMap?
-          # Set the label map parent reference.
-          paramResult.labelMap.parameterResult = paramResult
-          # If the label map has a color table, then set
-          # the overlay property.
-          Object.defineProperties paramResult,
-            # @returns the parameter result label map
-            overlay:
-              get: ->
-                @labelMap 
-  
-      # TODO - delegate all modeling to Modeling service.
-      # Adds the modeling result parent modeling object
-      # reference property and extends the parameter result
-      # objects as described in extendParameterResult.
-      #
-      # @param modelingResult the modeling result object to extend
-      # @param modeling the parent modeling object
-      extendModelingResult = (modelingResult, modeling) ->
-        # Set the modeling result parent reference.
-        modelingResult.modeling = modeling
-        # Extend each modeling parameter result object.
-        for key, paramResult of modelingResult
-          extendParameterResult(paramResult, modelingResult, key)
-  
-      # Extends the modeling result as described in
-      # extendModelingResult and adds the following
-      # modeling object properties:
-      # * session - the parent session object reference
-      # * overlays - the modeling result overlays
-      #
-      # @param modeling the modeling object to extend
-      # @param session the parent session object
-      extendModeling = (modeling, session) ->
-        # Set the modeling parent session reference.
-        modeling.session = session
-        # Extend the modeling result object.
-        extendModelingResult(modeling.result, modeling)
-        # Add the virtual properties.
-        Object.defineProperties modeling,
-          # @returns the modeling results which have an overlay,
-          #   sorted by modeling parameter name
-          overlays:
-            get: ->
-              # Filter the modeling results for files with an overlay.
-              overlayed = (
-                res for res in _.values(@result) when res.overlay?
-              )
-              # Sort the overlayed results.
-              sorted = _.sortBy(overlayed, 'key')
-              # Pluck the overlay from the overlayed results.
-              _.map(sorted, 'overlay')
-      
+    'Resources', 'Scan', 'Modeling', 'ObjectHelper',
+    (Resources, Scan, Modeling, ObjectHelper) ->
       # @param session the session to navigate
       # @returns the session {modeling protocol: overlays}
       #   associative object, or null if there are no overlays

        # @returns the augmented accumulator
        associate = (accum, modeling) ->
          accum[modeling.protocol] = modeling.overlays
        # The modeling objects with at least one overlay
        overlayed = (
          mdl for mdl in session.modelings when mdl.overlays.length?

        session.subject = subject
        # Set the session number property.
        session.number = number
        # Augment the modeling objects.
        for modeling in session.modelings
          Modeling.extend(modeling, session)
        # Add the overlays property.
        session.overlays = getOverlays(session)
        # Add the virtual properties.
