tweaked middlware line