First changes for thread synchronization