code example from tutorial https://developer.apple.com/library/ios/referencelibrary/GettingStarted/RoadMapiOS/index.html