implemented some functions in server.c