Altered the way middleware is uses settings