Removed unused imports, tweaked Werkzeug import and general PEP8 formatting improvements.