 
   # add the listeners to a chain which provide ordering
   _addOrdering: (chain) ->
-    chain.on 'add', markChanged
-    chain.on 'remove', markChanged
-    chain.on 'start', ensureOrdered
+    chain.on 'add', markChanged      # only do ordering when we add something
+    chain.on 'remove', markChanged   # or if we remove something
+    chain.on 'start', ensureOrdered  # do the ordering once before starting
+    chain.add checkOrderedError      # if there's an error then fail()
     return chain
 
 


# order the array before a chain run executes
ensureOrdered = (event) ->
  unless event.chain.__isOrdered is true
    order event.chain.array
    event.chain.__isOrdered = true


class Cio

  # build a new client socket, return the socket or the build chain failure
  client: (options) ->
    result = @_run @getClientChain(), options
    if result.failed? or result.error? then result
    else result.context.client


  # build a new server socket, return the socket or the build chain failure
  server: (options) ->
    result = @_run @getServerChain(), options
    if result.failed? or result.error? then result
    else result.context.server


