server.py modified almost final