One thing I see is at the end, you have basically the same loop several times. Twice for parental races, and then again for the job. I would probably try to make that a function that I call three times to neaten it up.
so all races and jobs would go to one list ?