   class $.attachinary.Attachinary
     constructor: (@$input, @config) ->
       @options = @$input.data('attachinary')
-      @options.files_container_selector = @config.filesContainerSelector if @config.filesContainerSelector?
+      
+      if @config.filesContainerSelector?
+        _filesContainer = @config.filesContainerSelector
+        @config.filesContainerSelector = if _.isFunction(_filesContainer) then _filesContainer else -> $(_filesContainer)
+
+      _dropZone = @config.dropZone
+      @config.dropZone = if _.isFunction(_dropZone) then => _dropZone(@$input) else -> _dropZone
 
       @files = @options.files
 

        paramName: 'file'
        headers: {"X-Requested-With": "XMLHttpRequest"}
        sequentialUploads: true
        dropZone: @config.dropZone || @$input

      $.extend options, @config.uploadConfig




    addFilesContainer: ->
      if @config.filesContainerSelector?
        @$filesContainer = @config.filesContainerSelector(@$input)
      
      unless @config.filesContainerSelector? and @$filesContainer.length > 0
        @$filesContainer = $('<div class="attachinary_container">')
        @$input.after @$filesContainer



    redraw: ->
      @$filesContainer.empty()
