 
   return range
 
-findClosePairRangeForward = (options, fn) ->
+findClosePairRangeForward = (finder, options) ->
   {allowForwarding, from} = options
   delete options.allowForwarding
 
-  findPairRange 'close', 'forward', options, (stack, openEvent) ->
+  finder 'close', 'forward', options, (stack, openEvent) ->
     unless openEvent?
       return true
 

    filters = @getFilters()
    options = {@editor, from, filters, @allowNextLine, @allowForwarding}

    return unless closeRange = findCloseTagRangeForward(options)

    options.from = closeRange.end
    return unless openRange = findOpenTagRangeBackward(options)

    aRange = new Range(openRange.start, closeRange.end)
    innerRange = new Range(openRange.end, closeRange.start)

  {
    state: if (backslash is '') then 'open' else 'close'
    name: event.match[2]
    range: event.range
  }

findTagState = (stack, state, name) ->
  for tagState in stack by -1 when (tagState.state is state) and (tagState.name is name)
    return tagState

class Tag extends Pair
  @extend(false)
