Refactor filters to reflect new data structure

Significantly improves readability and testability of code.