use OO to rewrite server.py