Implemented synchronize/UpdateState. Added test file for synchronize.
Adds latest changes from sync