Add support for middlwares too.