 # coffeelint: disable=cyclomatic_complexity
 module.exports = (options = {}, callback) ->
 
-  { dash }  = require 'bongo'
+  async     = require 'async'
   encoder   = require 'htmlencode'
   { argv }  = require 'optimist'
 


  queue = [

    (next) ->
      socialApiCacheFn = require '../cache/socialapi'
      socialApiCacheFn options, (err, data) ->
        console.error 'could not get prefetched data', err  if err
        socialapidata = data
        next()

    (next) ->
      groupName = session?.groupName or 'koding'

      # due to some reason, I suspect JSON.stringify somewhere, undefined


        currentGroup = group  if group

        fin()

    (fin) ->
      bongoModels.JWorkspace.fetchByMachines$ client, (err, workspaces) ->
        console.log err  if err
        userWorkspaces = workspaces or []
        fin()

    (fin) ->
      bongoModels.JMachine.some$ client, {}, (err, machines) ->
        console.log err  if err
        userMachines = machines or []
        fin()

    (fin) ->
      bongoModels.Sidebar.fetchEnvironment client, (err, data) ->
        userEnvironmentData = data
        fin()

    (fin) ->
      client.connection.delegate.fetchUser (err, user) ->
        if err
          console.error '[scriptblock] user not found', err
          return fin()

        if user then userId = user.getId()
        else console.error '[scriptblock] user not found', err
        fin()
  ]

  async.parallel queue, -> callback null, createHTML(), socialapidata
