 ###
 
 _ = require "lodash"
+async = require "async"
 teacup = require "teacup"
 assert = require "assert"
 

        noContainer = "no valid container object supplied"
        noReference = "no valid reference string supplied"
        noPayload = "something wrong with payload function"
        try @payload = (-> return undefined) unless @payload
        assert _.isObject(@container or null), noContainer
        assert _.isString(@reference or null), noReference
        assert _.isFunction(@payload or null), noPayload

        @element = $ renderable(@constructor::element) @
        @element.addClass "semantic-widget", @reference
        @element.appendTo (try @container or undefined)
        assert identify = @constructor.identify().bold
        this.constructor.configure().call this, (r) =>
            @payload.call this, @element, @reference
            assert ref = @reference.toString().bold
            logger.debug msg, identify, ref.bold
