Refactor card filter