filtering2 including sealed traits and pattern matching and func refactors