First part of changes acording to code rewiev. Mostly style and formating changes.
Final code reformat acording to code review.
Damm you file permissions :/. Another fix.