fixed toString using StringBuilder instead of output to console directly