Took the responsibility for thread synchronization during optimization off the library.