Clean up filtering.

Fixes #13.
Merge pull request #14 from palantir/clean_filtering

Clean up filtering.