     index = @children.indexOf(child)
     throw new Error("Removing non-existent child") if index is -1
     @children.splice(index, 1)
+    @reparentLastChild() if @children.length < 2
+
 
   replaceChild: (oldChild, newChild) ->
     index = @children.indexOf(oldChild)

      @subscribe child, 'destroyed', => @removeChild(child)

    @subscribe @children.onRemoval (child) => @unsubscribe(child)

    @when @children.$length.becomesLessThan(2), 'reparentLastChild'
    @when @children.$length.becomesLessThan(1), 'destroy'

  deserializeParams: (params) ->
    {container} = params


  reparentLastChild: ->
    @parent.replaceChild(this, @children[0])
    @destroy()
