filter implementation improved