middleware changes and additions