Avoid synchronization if not needed
refactoring: factor out common code