refactor reason->rtype to type