cleaned up formatting

Only code formatting was performed, using conventions:
- code blocks use only 2 space indentation
- multi-line code blocks have matching open and close brace on same column number 

Any changes to code functionality (other than debugging output) were hopefully avoided.