 	}
     
 	@IBAction func pickImageFromAlbum(sender: AnyObject) {
+        pickImage(UIImagePickerControllerSourceType.PhotoLibrary)
+	}
+
+	@IBAction func pickImageFromCamera(sender: AnyObject) {
+		pickImage(UIImagePickerControllerSourceType.Camera)
+	}
+
+	func pickImage(sourceType: UIImagePickerControllerSourceType) {
 		let imagePickerController = UIImagePickerController()
 		imagePickerController.delegate = self
-		imagePickerController.sourceType = UIImagePickerControllerSourceType.PhotoLibrary
-		presentViewController(imagePickerController, animated: true, completion: nil)
-	}
-
-	@IBAction func pickImageFromCamera(sender: AnyObject) {
-		let imagePickerController = UIImagePickerController()
-		imagePickerController.delegate = self
-		imagePickerController.sourceType = UIImagePickerControllerSourceType.Camera
+		imagePickerController.sourceType = sourceType
 		presentViewController(imagePickerController, animated: true, completion: nil)
 	}
 

        let chooseFontController = segue.destinationViewController as! ChooseFontViewController
        chooseFontController.chooseFontViewDelegate = self
    }
    
}

	override func viewDidLoad() {
		super.viewDidLoad()

        setTextFieldProperties(topText, displayText: "TOP")
        setTextFieldProperties(bottomText, displayText: "BOTTOM")
    }

    func setTextFieldProperties(textField: UITextField!, displayText: String?) {
        textField.delegate = self
        textField.defaultTextAttributes = memeTextAttributes
        textField.textAlignment = .Center
        textField.text = displayText
    }
