Merge pull request #3 from amsross/master

Added rewrite registering and flushing on activation
Merge pull request #1 from jcollings/master

Merge pull request #3 from amsross/master