Improved class print method