 
 class MoleculeViewController: UIViewController {
 
+    let pdbLoader = PDBLoader()
     var pdbFile: String = ""
+    
+    var scene = SCNScene()
+    var molNode = SCNNode()
     
     override func viewDidLoad() {
         super.viewDidLoad()
         
         println("MVC viewDidLoad \(pdbFile)")
         
-        let pdbLoader = PDBLoader()
         pdbLoader.loadMoleculeForPath(pdbFile)
         self.title = pdbLoader.molecule.name
-
-        let scene = SCNScene()
 
         let cameraNode = SCNNode()
         cameraNode.camera = SCNCamera()

        */
    }
    
    func handleTap(gestureRecognize: UIGestureRecognizer) {
        // retrieve the SCNView
        let scnView = self.view as SCNView
        
        // check what nodes are tapped
        let p = gestureRecognize.locationInView(scnView)
        let hitResults = scnView.hitTest(p, options: nil)
        
        // check that we clicked on at least one object
        if hitResults.count > 0 {
            // retrieved the first clicked object
            let result: AnyObject! = hitResults[0]
            
            // get its material
            let material = result.node!.geometry.firstMaterial
            
            // highlight it
            SCNTransaction.begin()
            SCNTransaction.setAnimationDuration(0.5)
            
            // on completion - unhighlight
            SCNTransaction.setCompletionBlock {
                SCNTransaction.begin()
                SCNTransaction.setAnimationDuration(0.5)
                
                material.emission.contents = UIColor.blackColor()
                
                SCNTransaction.commit()
            }
            
            material.emission.contents = UIColor.redColor()
            
            SCNTransaction.commit()
        }
    }
    
    override func shouldAutorotate() -> Bool {

        let scnView = self.view as SCNView
        scnView.scene = scene
        scnView.allowsCameraControl = true
        // scnView.showsStatistics = true
        scnView.backgroundColor = UIColor.blackColor()
        
        /* add a tap gesture recognizer
