added support for middleman