       .replace(/^-+|-+$/g, "")      # trim leading and trailing hyphens
 
   generateUniqueSlug =(constructor, slug, i, callback)->
-    [callback, i] = [i, callback] unless callback
-    i ?= 0
     candidate = "#{slug}#{i or ''}"
     constructor.count slug: candidate, (err, count)->
       if err then callback err

  createSlug:(callback)->
    {constructor} = this
    {slugifyFrom} = constructor
    slug = generateSlug @[slugifyFrom]
    generateUniqueSlug constructor, slug, callback

module.exports = class Slugifiable

  slugify =(str)->
    slug = str
      .toLowerCase()                # change everything to lowercase
      .replace(/^\s+|\s+$/g, "")    # trim leading and trailing spaces
