Split controllers into separate modules

middleware.py has too many classes.  Let's split them into separate modules.

Change-Id: I25a1252fa4c6c0686b175889ad8f953caaf0a362