use stringbuilder, simpler loop