refactor polymorphic