Moving middleware and increasing test coverage