Working sync code

At least I think. Still need to add reading, and logic for
multi-device sync