Split into server, client and public interface