Refactor Replace Type Code with Subclasses