     }
   }
   
+  let startTime : Double = CACurrentMediaTime()
+  var lastTime : Double = 0
+  var runTime : Double = 0
+  var frameTime : Double = 0
+  
   var socket : WebSocket? = nil
+  
+  var latestSocketData : String?
   
   override func viewDidLoad() {
     super.viewDidLoad()

//    view.drawableDepthFormat = .Format24
    view.drawableStencilFormat = .Format8
    
    self.setupGL()
    self.setupSocket()
  }
  
  func setupSocket()

  // MARK: - GLKView and GLKViewController delegate methods
  
  func update() {
    // Calculate the frame times
    let nowTime : Double = CACurrentMediaTime()
    runTime = nowTime-startTime
    frameTime = nowTime - lastTime
    lastTime = nowTime
    
    // Parse the latest data
    if let data = latestSocketData {
      let json = JSON(data: data.dataUsingEncoding(NSUTF8StringEncoding)!)
      latestSocketData = nil
      if let inst = display {
        // Convert the JSON into a dictionary
        inst.update(json.dictionaryValue)
      }
    }
    
    let aspect = fabsf(Float(self.view.bounds.size.width / self.view.bounds.size.height))
    let drawWidth = display?.screenWidth ?? 1.0
    let drawHeight = display?.screenHeight ?? 1.0
