refactor sync and access settings

Uhm, this branch may be confusingly named. This is part of the commits from #278, which has far too many commits and should be split in separate pull requests.

I tested this so far only with litewrite, but it worked well.