Making it work with new middleware format