Replace StrignBuffer with StringBuilder and remove unnecessary synchronized