Manually merge Engineer's PR #166.

This puts the brackets back on the if statements and manually merges the PR from Engineer.