Rewrite concatenation, filtering and unique