[refactoring] Add not refactored replace type code with polymorphism.
[refactoring] Add replace type code with polymorphism.