Improved dump() method