better filtering of strings