split server/client code