As sediments continue to accumulate in the depositional environment, older sand is buried by younger sediments, and it undergoes diagenesis. This mostly consists of compaction and lithification of the sand. Early stages of diagenesis, described as "eogenesis", take place at shallow depths (a few tens of meters) and is characterized by bioturbation and mineralogical changes in the sands, with only slight compaction. The red hematite that gives red bed sandstones their color is likely formed during eogenesis. Deeper burial is accompanied by "mesogenesis", during which most of the compaction and lithification takes place.