Finished refactoring code to use StringBuilder