Some small changes. Rewrite of resync logic using Dexie promises