Improved ToString implementation