 
                 waitForFlow = ->
                   if window._phantom_running_
-                    console.log 'Flow still running...'
+                    console.log 'ACK'
                     setTimeout waitForFlow, 2000
                   else
-                    console.log 'Flow completed'
+                    console.log 'Flow completed!'
                     errors = window._phantom_errors_
                     # delete all keys from the k/v store
                     context.requestRemoveAll ->

                (Flow.Async.iterate tasks) go

          runFlow = (packName, flowName, go) ->
            console.log "Fetching flow: #{packName} - #{flowName}"
            context.requestFlow packName, flowName, (error, flow) ->
              if error
                console.log 'Failed fetching flow'
                go error
              else
                flowTitle = "#{packName} - #{flowName}"

          window._phantom_started_ = yes
          runPacks (error) ->
            if error
              console.log '*** ERROR *** Error running packs: ' + JSON.stringify error
            else
              console.log 'Finished running all packs!'
            window._phantom_exit_ = yes
          no

    waitFor test, ->
      errors = page.evaluate -> window._phantom_errors_
      if errors
        console.log 'PHANTOM: *** ERROR *** One or more flows failed to complete: ' + JSON.stringify errors
        phantom.exit 1
      else
        console.log 'PHANTOM: Success! All flows ran to completion!'
        phantom.exit 0
  else
    console.log 'PHANTOM: *** ERROR *** Unable to access network.'
    phantom.exit 1


