Style point: space after ```if```, ```foreach```, etc., but _not_ before the _content_ of the brackets ```()``` as on line 1157 above.  There are various points in the code where this applies, it would be churlish of me to mark them all. :-)