Added most of the server code.
Added server code.