make middleware abstract
formatting