     cmd.on 'close', (code) ->
       console.log 'lxc-execute process exited with code ', code
 
-
 kite.worker manifest, 
   # This is a dummy method of the kite.
   deploy: (options, callback) ->
-    {zipUrl, name} = options
-    lxc = new LXC(name)
-    lxc.createLxc () ->
-      console.log ">>>", name
-      deployment = new Deployment(zipUrl, name, lxc)
+    {id, kiteName, zipUrl} = options
+    deployment = new Deployment(id, kiteName, zipUrl)
+    deployment.create-lxc () ->
       deployment.downloadAndExtractKite deployment.runKite.bind deployment
 
     return callback null, "Hello, I'm #{name}! This is Deployer"

      console.log 'create lxc process exited with code ', code
      callback()

class Deployment
  constructor: (@zipUrl, @name, @lxc) ->
    console.log "......Deployment constructor",  @lxc
    @kitePath = path.join @lxc.pathToContainers, @lxc.name, "overlay", "opt", "kites"

  downloadAndExtractKite: (callback) ->
    {kitePath, zipUrl, name} = this
    fs.mkdirsSync(kitePath) ## TODO mkdir creates 0777, exists check
    
    filepath = path.join kitePath, "#{name}.zip"
    file     = fs.createWriteStream filepath

    console.log "downloading url", zipUrl, " to ", filepath

      response.on "end", () ->
        console.log "file download complete", response.statusCode
        if response.statusCode is 200
          cmd = spawn "unzip", [ path.join(@kitesPath, "#{kiteName}.zip"), "-d", @kitesPath]
          console.log 'unziping kite'
          
          cmd.stdout.on 'data', (data) ->
