server: refactoring

Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>
client: refactoring

Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>