Replace Type Code With Polymorphism