improved StringBuffer usage