added factory support for middleware