Use type_id instead of object_id, and some commented code for generics