addaptated to iOS