replaced all StringBuffers with StringBuilder to improve performance