adjust the server/client code stubs

factoring out common stuff