Changed middleware flow.