Please to refactor to do less instaceof checks.