working filters to middleware