Don't duplicate identical code in the two if branches. Just put it after the if.