Fix exact sync and some code re-structuration