Move synchronization logic to it's own module.