Prepare base64 encoding
Implement v3 scheme, fix bugs.

Database loss on sync errors should be fixed for now.
Backup database before writes.

Just in case the bug isn't actually fixed.