Cleanup

Fixes some type checks and some indentation, and removes some redundant checks.

13ea12d doesn’t need to be applied.