Refactor client and server to ease their configuration