move the middleware interface into the main package