Does it make more sense to add more specific definition in line 9 so that we can avoid this line of comparison, which seems doubling the work?