code for ios finished and now working