refactor to use flask-restful