There's no need for this to be a nested if block, it can simply be an elsif on the parent.