Lots of improvements to filtering and database