some refactoring of the client done