Refactoring the TYPE command