Formatting updates to improve readability.

It might look like a lot, but most changes involve returning early to reduce nesting.
Don't really see the point in this?