Working server code - Joint effort.