Syntax cleanup to improve code readability.

Hi Vadim,

I was reading the code as I was debugging and thought I could give it a try to make the syntax more consistent and easier to read. It might look like a big commit but it's just many small changes. I have only changed syntax such as tabs, new spaces and added spaces before some "{" that missed spaces. There should not be any change in how the code runs.

If you think it looks okay it would be great of you could accept the pull request. 

Regards, Robert