recreate server code