Refactoring and add new test for sync duration