Fix tabs in API.cpp
Delete unnecessary code
Improve CriticalSection.cpp