refactor iOS client