As promised, pull request to remove unneeded code

And also removes a possible hidden bug. Tests pass, although I think there are no tests at the moment for the middleware component.