some refactoring to cross-platform clients