Reorganize filter functions

Fixes #60