refactor examples and client factory