Replacing if-else with rule constructs