Refactor ApplyRules method to make slightly easier to read.

Very minor change, just thought it would make the logic a tiny bit easier to read.