Added smarter filtering