Add additional cleanup changes

The cleanup started as changeset to remove the C++ part of the source code because it is actually only C stuff and the C++ symbols only made it "harder" to share the code with the C parts. During this procedure other things were noticed which could be changed to make the code a little bit more readable. There are many more things which could be done but I wanted submit the first part to avoid merge problems with Bobby Smiles.