Slightly different but seems to work

This discussion says it's fine,  I was wondering that myself. 

Is there a reason for the extra boolean variable? does that practice come in handy later on?