Remove trailing whitespace.
Put operators in order of precedence.
Add test case for if with else inside if without else.

Also tests precedence of logical OR vs AND.