 
     queue = [
 
-      ->
+      (next) ->
         # validating data params
         unless account instanceof JAccount
-          return callback new KodingError 'account is not an instance of Jaccount!'
+          return next new KodingError 'account is not an instance of Jaccount!'
 
         JGroup.one { slug : group }, (err, group_) ->
-          return callback err                                 if err
-          return callback new KodingError 'group not found!'  unless group_
+          return next err                                 if err
+          return next new KodingError 'group not found!'  unless group_
 
           unless !!group_.getAt 'isApiEnabled'
-            return callback new KodingError 'API usage is not enabled for this group.'
+            return next new KodingError 'API usage is not enabled for this group.'
 
           groupObj = group_
-          queue.next()
+          next()
 
-      ->
+      (next) ->
         limitError = "You can't have more than #{JGroup.API_TOKEN_LIMIT} api tokens"
         JApiToken.count { group : groupObj.slug }, (err, count) ->
-          return callback err                         if err
-          return callback new KodingError limitError  if count >= JGroup.API_TOKEN_LIMIT
-          queue.next()
+          return next err                         if err
+          return next new KodingError limitError  if count >= JGroup.API_TOKEN_LIMIT
+          next()
 
-      ->
+      (next) ->
         # creating token
         token = new JApiToken
           code     : hat()

hat           = require 'hat'
JGroup        = require './group'
JAccount      = require './account'
jraphical     = require 'jraphical'
KodingError   = require '../error'
{ permit }    = require './group/permissionset'
{ daisy
  secure
  ObjectId
  signature } = require 'bongo'


          originId : account.getId()

        token.save (err) ->
          return next err  if err
          token.username = account.profile.nickname
          next()

    ]

    async.series queue, (err) ->
      return callback err  if err
      callback null, token


  @create$: permit
