Filter reimplementation

As discussed, here is the pull request for changed filter implementation, with updated documentation and some small fixes.