You will find your code easier to read if you pick a
consistent indentation style and stick to it. What
exactly you pick, hanging vs inline braces, etc doesn't
so much matter as long as the indent is in the range 2-4
spaces and the style is consistent. If you do that then
it is possible to see the logical structure of the code
at a glance, which greatly simplifies understanding it.
Also the better way to do the above is to have a logging
function that you pass messages to. By default it would
do nothing, but turn on a flag and you get a useful
debugging trace out...