Remove unnecessary middleware code.