Refactoring: moving base-client part out; does not really belong here