working server code