Merge pull request #1 from guywithnose/master

Fix sync
Make the math more resilient.
Merge pull request #2 from nubs/master

Make the math more resilient.
Cache watermark