Implementation of filter.