Added clarifying comments to nested loops