from bitfountain's iOS 8 Swift tutorial