     
     static let sharedManager = YepAudioService()
     
-    var audioRecorder: AVAudioRecorder!
-    
-    override init() {
-        super.init()
-        prepareAudioRecorderWithURL(newURL())
-    }
-    
-    func prepareAudioRecorderWithURL(url: NSURL) {
+    var audioRecorder: AVAudioRecorder?
+
+    func prepareAudioRecorderWithFileURL(fileURL: NSURL, audioRecorderDelegate: AVAudioRecorderDelegate) {
         let settings = [
             AVFormatIDKey: kAudioFormatMPEG4AAC,
             AVEncoderAudioQualityKey : AVAudioQuality.Max.rawValue,

        ]
        
        var error: NSError?
        audioRecorder = AVAudioRecorder(URL: url, settings: settings as [NSObject : AnyObject], error: &error)
        if let e = error {
            println(e.localizedDescription)
        } else {
            audioRecorder.meteringEnabled = true
            audioRecorder.prepareToRecord() // creates/overwrites the file at soundFileURL
        }
    }
    
    func newURL() -> NSURL {
        var newCacheURL = cacheURL()
        return newCacheURL.URLByAppendingPathComponent("\(randomStringWithLength(16)).aac")
    }
    
    func beginRecord() {
        
        AVAudioSession.sharedInstance().requestRecordPermission({(granted: Bool)-> Void in
            if granted {
                
                if (self.audioRecorder.recording){
                    self.audioRecorder.stop()
                }else{
                    self.audioRecorder.record()
                    println("Audio Record did begin")
                }

//                NSTimer.scheduledTimerWithTimeInterval(0.1,
//                    target:self,
//                    selector:"updateAudioMeter:",
//                    userInfo:nil,
//                    repeats:true)
            } else {
                println("Permission to record not granted")
            }

    }
    
    func endRecord() {
        if let audioRecorder = audioRecorder {
            if (audioRecorder.recording){
                audioRecorder.stop()
            }
        }
    }
}
