Did some refactoring on the iOS sample app.