Add filter and rule: code and unit_test