refactoring server.c
Still with bugs, but at least it is better organized