write my own middleware!