cleaning up server.py
better json responses