NItpick: The rest of your changes seemed to favor `arr.length` over `!arr.empty`. In particular, it reads more like the existing code here.