Fixed type checks. Simplified toString.