Change middleware to be configured with classes, not instances