If I'm honest I don't like either and yours has more nesting. I tried to keep the change as minimal as possible so avoided a refactor. I must admit I did try a couple of options, but nothing elegant emerged so I decided to keep it simple.