           unsubAll() if reply == Bacon.noMore
           reply
     checkQueue = ->
-      event = _.popHead(queue)
+      event = queue.splice(0,1)[0]
       spawn event if event
     checkEnd = (unsub) ->
       unsub()

        sink(end())
        reply = Bacon.noMore
      else
        value = _.popHead(values)
        reply = sink(toEvent(value))
    -> unsubd = true



  flatDeps = {}
  
  dependsOn = (b) ->
    myDeps = flatDeps[this.id]
    if !myDeps
      myDeps = flatDeps[this.id] = {}
      collectDeps this, this
    return myDeps[b.id]
  
  collectDeps = (orig, o) ->
    for dep in o.internalDeps()
