Synchronizion with critical sections and removed redundant comments