Server code

Completed server code