Add Sync function. Fixes #31.