code was added for prettyPrint() and toString() method