Formatting cleanup
Add a few additional checks.