     
     return false
 
-$.fn.modal = (action) ->
+$.fn.modal = (action, argument) ->
   section = ".bbm-modal__section"
   path = $(this).attr('data-path')
   switch action

      form = $("form[data-path='#{path}']")
      steps = $(form).find('*[data-modal-step]')
      modal = $("script[type='text/template'][data-path='#{path}']")

      # beforesubmit handler
      beforeSubmit = =>
        form[0].submit()

      modalOptions = if steps.length > 0


              $(oldStep).replaceWith $(step).clone()
            , 20)

          nextStep: (e, options) ->
            target = if e
              e.preventDefault()
              target = e.target
            else
              this.el
            
            # updates invisible form with changes made in this step.
            section = $(target).parents('.modal').find('.bbm-modal__section')
            step = $(form).find('*[data-modal-step]')[@currentIndex]
            newStep = section.children('*[data-modal-step]')[0]
            newStep = $(newStep).clone() if options? and options.clone
            $(step).replaceWith(newStep)

            @next()

          beforeSubmit: ->
            return false if @submitting
            @submitting = true # block further submits

            @nextStep(null, clone: true)
            $(this.el).modal('setDisplay', 'submitting')
            form[0].submit()
            return false # to block disappearance

          beforeCancel: -> !@submitting
        }
      else
        { 
          cancelEl: '.close'
          submitEl: '.submit'
          template: _.template($(modal).html())

          beforeSubmit: ->
            return false if @submitting
            @submitting = true # block further submits

            # replace innerHTML of invisible form with fields inside the modal
            $(form).empty()
            section = $(this.el).find('.bbm-modal__section').clone()
            $(form).append(section)

            # display changes when submitting
            $(this.el).modal('setDisplay', 'submitting')

            # submit form
            form[0].submit()
            return false # to block disappearance

          onRender: ->
            $(this.el).modal('replaceSubmit')

          beforeCancel: -> !@submitting
        }

      Modal = Backbone.Modal.extend(modalOptions)
