add sample client
some refactoring