Felipe's improved bracket-based loop, with comments #146