My solution checks, if the exact unit has the classification, whereas yours checks, if the unit type pf the unit has the classification. For example of all of your peasants always have the classification "worker", that makes no difference, but if you change classifications of specific units (remove worker classifications of a certain pesant) this will make a difference. I doubt you would do anything like that, so it does not matter. Especially since it's at map initialization, so I am pretty sure you won't change classifications of single units before that.