Performance improvement for rule engine

By profiling a performance it was identified that it would speed up the processing if the rule engine would not look into model too often. A fix is provided in the below pull request.