Refactored type_id(value,type) using pattern matching.