Fixes and improvements to filtering

* Adds a color legend for filters
* Adds a count for choices
* Fixes bug where filters wouldn't be styled correctly if you select an object
* Filtering logic is a little easier to follow (but still somewhat insane)
* Better handling of undefined/null values for filters