     /// Update the UI labels and image only if there is a valid performance loaded.
     func updateUI() {
         print("JAMVC: Updating UI.")
-//        print("Settings Data: ")
-//        print("Performer: ", UserDefaults.standard.string(forKey: SettingsKeys.performerKey) ?? "name could not be loaded")
-//        print("Instrument:", SoundSchemes.namesForKeys[UserDefaults.standard.integer(forKey: SettingsKeys.soundSchemeKey)] ?? "name could not be loaded")
-        
         switch self.state {
         case ChirpJamModes.new:
             self.navigationItem.title = "New Performance"
             self.statusLabel.text = "new"
             self.performerLabel.text = UserDefaults.standard.string(forKey: SettingsKeys.performerKey)
             self.instrumentLabel.text = SoundSchemes.namesForKeys[UserDefaults.standard.integer(forKey: SettingsKeys.soundSchemeKey)]
+            print("JAMVC: opening Pd file for new performance.")
+            (UIApplication.shared.delegate as! AppDelegate).openPdFile(withName: self.instrumentLabel.text!)
         case ChirpJamModes.recording:
             self.navigationItem.title = "recording..."
             self.statusLabel.text = "recording..."

            }
        }
    }
    
    var playbackTimers : [Timer]?
    
    /// MARK: - UI Interaction Functions
    @IBAction func playButtonPressed(_ sender: UIButton) {

    }
    
    // MARK: - Touch methods
    
    /// touchesBegan method starts a recording if this is the first touch in a new microjam.
    override func touchesBegan(_ touches: Set<UITouch>, with event: UIEvent?) {
        // start timer if not recording
        let p = touches.first?.location(in: self.chirpeySquare);
