Server, client: Common code simplification