This line is repeated in both the `if` and `else` and again on this line. Find a way to dry this up.