Applied all fixes related to translating C to C++ code
Also fixed some typos and code alignment