fixed indentation
use string buffer to speed up