Using pattern matching would make sense here, instead of calling `isInstanceOf` and the extractor by hand.