I did an early return here because with the existing nested `if` statements, things looked a bit hard to follow. I can play with flipping those around and see if that still looks readable.