Merge pull request #2 from nubs/master

Make the math more resilient.
Cache watermark
Merge pull request #3 from guywithnose/master

Cache watermark