           else
             source.push e.value
             if source.sync
-              console.log "queuing", _.toString(resultStream)
+              #console.log "queuing", e.toString(), _.toString(resultStream)
               triggers.push {source: source, e: e}
               # TODO flush immediately if no flattened sources
               flushLater()

        flushLater = ->
          UpdateBarrier.whenDone resultStream, flush
        flush = ->
          console.log "flushing", _.toString(resultStream)
          reply = Bacon.more
          while triggers.length > 0
            trigger = triggers.pop()
            for p in pats
               if match(p)
                 console.log "match", p
                 val = -> p.f(sources[i.index].consume() for i in p.ixs ...)
                 reply = sink trigger.e.apply(val)
                 console.log "triggers now", triggers
                 triggers = _.filter ((trigger) -> !trigger.source.flatten), triggers
                 break
          if _.all(sources, cannotSync) or _.all(pats, cannotMatch)
            reply = Bacon.noMore
            sink end()
          unsubAll() if reply == Bacon.noMore
          console.log "flushed"
          reply
        source.subscribe (e) ->
          if e.isEnd()

      shouldBounceInitialValue = => @hasSubscribers() or ended
      reply = current.filter(shouldBounceInitialValue).map(
        (val) ->
          UpdateBarrier.inTransaction this, ->
            sink initial(val()))
      if reply.getOrElse(Bacon.more) == Bacon.noMore
        nop
      else if ended
