improve Filter.js: faster code