move functioanlity to client factory

similar to what we did before on server