Moved server code into c-lib, currently unstable.