refactoring type converter