 class AppDelegate: NSObject, NSApplicationDelegate {
 
     let desktopPath = "/Users/teo/Desktop/"
-//    let fileName = "64.mp3"
+    let fileName = "64.mp3"
 //    let fileName = "low.wav"
-    let fileName = "64.wav"
+//    let fileName = "64.wav"
 //        let fileName = "small64.m4a"
     
     func applicationDidFinishLaunching(aNotification: NSNotification) {
 
-        let maxLength = 1200
+        /// Set the maximum number of seconds we're going to use for fingerprinting
+        let maxLength = 120
+        
         /** Create a single instance of an unsafe mutable Int8 pointer so we can 
             pass it to chromaprint_get_fingerprint without errors. 
-            The defer ensures it is not leaked.
+            The defer ensures it is not leaked if we drop out early.
         */
         var fingerprint = UnsafeMutablePointer<Int8>.alloc(1)
         defer {
-            print("Destroy & dealloc fingerprint")
             fingerprint.destroy()
             fingerprint.dealloc(1)
         }
         
         /// Start by creating a chromaprint context.
         /// Not sure why CHROMAPRINT_ALGORITHM_DEFAULT isn't defined here.
-//        let algo : Int32 = 1 //UInt32(CHROMAPRINT_ALGORITHM_TEST2.rawValue)
         let algo = Int32(CHROMAPRINT_ALGORITHM_TEST2.rawValue)
         let chromaprintContext = chromaprint_new(algo)
-
-        /// Get the song
-//        let fileName = "low.wav"
-
-//        let songUrl = NSURL(fileURLWithPath: "/Users/teo/Desktop/64.mp3" )
+        
+        /// Build the song path
         let songUrl = NSURL(fileURLWithPath: desktopPath+fileName )
         
-        /// Decode the song
+        /// Decode the song and get back its duration. 
+        /// The chromaprintContext will contain the fingerprint.
         let duration = decodeAudio(songUrl, withMaxLength: maxLength, forContext: chromaprintContext)
+        
         /** Make a fingerprint from the song data.
             (Note we can also get a hash back with chromprint_get_fingerprint_hash)
         */

                    max length * sample channels * sample rate
             */
            var remainingSamples = Int32(maxLength) * sampleChannels! * sampleRate!
            /// start off chromaprint
            chromaprint_start(context, sampleRate!, sampleChannels!)
            

                print("Error: No audio tracks found")
                return 0
            }
            
            let outputSettings: [String:Int] =
                [   AVFormatIDKey: Int(kAudioFormatLinearPCM),
                    AVLinearPCMIsBigEndianKey: 0,                   /// little endian
