added single lock for threads
commit
commit
commit
commit
commit
commit
commit
commit
commit