Improved generation of toString() method.