Database synchronization tentatively working. Needs extensive testing.