move logic after the `if`