     
     @IBAction func logWorkout(sender: UIButton)
     {
-        
-        
-        
         if workoutLog!.workout.attemptedAllSets() {
             workoutLog!.workout.checkForExerciseCompletion()
             LogManager.sharedInstance.addWorkoutLog(self.workoutLog!)
+            
+            if let url = imageURL {
+                let fileManager = NSFileManager()
+                if fileManager.fileExistsAtPath(url.absoluteString) {
+                    do {
+                        try fileManager.removeItemAtURL(url)
+                    }
+                    
+                    catch {
+                        print("path doesn't exist")
+                    }
+                }
+            }
             
             do {
                 try self.managedContext.save()

        let imagePicker = UIImagePickerController()
        imagePicker.delegate = self
        imagePicker.sourceType = .Camera
        
        presentViewController(imagePicker, animated: true, completion: nil)
    }
    
    func imagePickerController(picker: UIImagePickerController, didFinishPickingImage image: UIImage, editingInfo: [String : AnyObject]?) {
        dismissViewControllerAnimated(true, completion: nil)
        
        //Where to save image and how
    }
}

            return self.workoutLog!.workout.exercises.array as! [Exercise]
        }
    }
    var imageURL: NSURL!
    var workoutImage: UIImage!
    let documentsDirectoryPath = NSSearchPathForDirectoriesInDomains(.DocumentDirectory, .UserDomainMask, true)[0] as NSString
    let tempImageName = "temp_image.jpg"
    
    
    override func viewDidLoad()
    {
