re-created server code