Modified debug method to a toString() method