if and for code style changes

Putting if/then and for/do keywords on the same line, adding a
blank line before nested conditionals and loops.