Added iphone and ipad code after merging in most recent code