improvements to speed, some basic filtering