This block, starting from line 102, is both in `if` and `else` (line 148). Let's move it after `else` ends.