Added some code that writes the iphone file