using StringBuilder, only calling print once per