correctWithRules function

Deterministic correction