Updated rules-engine