added a rule factory object
merged last changes