can you extract that block and the one above into a private helper method? also don't use `else` then, but make it an early return for the matching `if` only.