Bug fix and cleanup

Fixed bug involving new version Swift 1.0 and Xcode 6.1.
Separated aspects of code into individual functions for fail and
success.