Alex's iphone version code is successfully merged into my updated code and works as intended.