Move inner logic of a client to its own module