         re = new RegExp "#{value[0]}|#{value[1]}", 'ig'
         query = query.replace re, "(?:#{value[0]}|#{value[1]})"
 
-      return query
+      query
 
     _createQueryRE: (query, type = 'infix')->
       return new RegExp "#{query}", 'ig'        if type == 'infix'
       return new RegExp "^#{query}", 'ig'       if type == 'prefix'
       return new RegExp "\\b#{query}\\b", 'ig'  if type == 'token'
       return new RegExp "^#{query}$", 'ig'      if type == 'absolute'
+
+    _createSortingREs: (query)->
+      re_abs = @_createQueryRE(query, 'absolute')
+      re_t = @_createQueryRE(query, 'token')
+      re_p = @_createQueryRE(query, 'prefix')
+
+      [re_abs, re_t, re_p]
 
     ## REFACTOR THOSE
     ## MAYBE REMOVE THOSE??

  # $.getScript "assets/json2.js" if StorageFreak.JSON_support() is false

  class StorageFreak
    # Sorts by exact query matching
    absolute_sort = (query, a, b) ->
      re_abs = @_createAccentIndependentRE(query, 'absolute')

      ((abs_match_a, abs_match_b) ->
        return -1 if abs_match_a
        return  1 if abs_match_b)(@config.match_func(re_abs, a.name),
                                  @config.match_func(re_abs, b.name))

    # Sorts by matching an exact token of the query
    token_sort = (query, a, b) ->
      re_t = @_createAccentIndependentRE(query, 'token')

      ((token_match_a, token_match_b) ->
          return -1 if token_match_a && !token_match_b
          return  1 if token_match_b && !token_match_a)(@config.match_func(re_t, a.name),
                                                        @config.match_func(re_t, b.name))

    # Sorts by matching query prefix
    prefix_sort = (query, a, b) ->
      re_p = @_createAccentIndependentRE(query, 'prefix')

      ((prefix_match_a, prefix_match_b) ->
        return -1 if prefix_match_a && !prefix_match_b
        return  1 if prefix_match_b && !prefix_match_a)(@config.match_func(re_p, a.name),
                                                        @config.match_func(re_p, b.name))

    # Sorts by aphabetical order
    lexicographical_sort = (a, b) ->

      for id, name of @_data
        results.push({id: id, name: name}) if match_func(re, name)

      results = results.sort ((a, b) -> sort_func(query, a, b))
      results.slice 0, @config.maxResultsNum

    _getRemoteData: (query, options)->
