Fixing some troubles in server.c; splitting it into 2 files.