Modified to use iOS 8's modern frameworks