refactored TypeTest