Updated sample code to work with IOS