What allowed for the earth to have layers during its formation?