Simplify code for applying filters to handlers