~str -> StrBuf where necessary. Made minimal changes