some refactoring for ios etc