modify according to comments
modify according to comments, add more synchronization control