Replaced repeated rules with variables.