added guid to each term to keep track of nodes

Cleaned up logic inside rule implementations.