Adding middleware support