Stars obtain their energy from nuclear-fusion reactions and these reactions can produce most elements and isotopes up to the neighbourhood of iron in the periodic table. Most more massive elements are also believed to be produced in stars by reactions involving the addition of neutrons. Mass loss from stars, both castastrophic and gradual, returns processed matter to the interstellar medium and in this way the raw material for the Solar System was assembled. It was originally believed that the Solar System was formed from a gas cloud that was chemically and isotopically homogeneous, with the variation of composition of objects today being attributed to processes occurring in the solar nebula. This was changed by the discovery of isotopic anomalies in meteorites. It is now clear that there was some departure from fine-scale mixing in the solar nebula. This may have resulted from late irradiation by a supernova or from the survival of interstellar grains with particular nucleosynthetic origins, or both, as well as from incomplete mixing of the interstellar gas.