Small simplfication on this if/else statement