A lot of behaviour in the Animal Kingdom for survival is built in genetically. Spirtually, God also has a code built in to humans that allows survival of the soul