Untested final version.

Needs testing with C server.