Implements server and client