By the beginning of the Devonian period (420 Mya) the sea was retreating from the Welsh Basin as the land was thrust up by the collision of land masses, forming a new range of mountains, the Welsh Caledonides. The Old Red Sandstone represents debris from their erosion. Elsewhere the strata were compressed and deformed, and in places, the clay minerals recrystallised, developing a grain that allowed parallel cleavage, making it easy to split the rocks into thin flat sheets of stone known as slate. In the early part of the Carboniferous period, reinvasion of southern and northern parts of Wales by the sea resulted in depositions of limestone, and extensive swamps in South Wales gave rise to peat deposits and the eventual formation of coal measures. Erosion of nearby upland areas resulted in the formation of sandstones and mudstones in the later part of the period. Southwestern Wales, in particular, was affected by the Variscan orogeny, a period when continental collisions further south caused complex folding and fracturing of the strata.