Remove middleware.py, fix #2