using stringbuffer instead of strcat/strncat