I think it's a good change! But, here the diff highlights some duplicated code that should just be moved outside of the if/else, could you include that in your patch?