Minor adjustments

- imports removed
- changed return string from String to StringBuffer (more efficient)
- moved string building loop outside of try block