code cleanup in flask_app