Add some comments, new type_name function