refactoring to synchronzing