almost finished with the server side