Implemented sync logic