Added backwards compatible support for middleware and instrumentation