Added server-client support.
Code needs tidying!