Optimisation to filter() and fix empty string not validating