fixing typos and patch to adhere to C++