     constructor: (@opts = {}) ->
         # values
         @builder = this
-        @pending = [] # no open child tag
         @checkers = {} # all the middlewares that have to approve a new tag
         # states
         @closed = no
+        @opened_tags = 0
         # defaults
         @opts.pretty ?= off
         @level = @opts.level ? -1

        @Tag = Tag
        @tag = new_tag
        @$tag = sync_tag

    end: () =>
        if @pending.length
            @closed = 'pending'
            @pending[0].once 'end', @end
        else
            @emit 'end' if not @closed or @closed is 'pending'
            @closed = yes
        this

    ready: (callback) =>

                @emit event, arguments...
        pipe event for event in EVENTS

        @emit 'add', this, tag
        @isempty = no
        tag.emit? 'close', tag if tag.closed
