Reduce instanceof operators
Replace janky string parsing with structured data