Wastewater is treated mainly in two ways: in rural areas, septic tanks are common, while in more populated areas homes are connected to wastewater treatment plants. A septic tank is a concrete or steel tank buried near a home, where raw sewage flows in from the house, solids separate from the liquid, and bacteria in the tank consume the solids. The liquid then flows into a drainfield, where it filters through gravel and eventually trickles through the soil. Wastewater can enter groundwater and rivers when septic tanks, sewage infrastructure, or wastewater treatment plants fail. In sewer systems, wastewater goes down the drain into a sewer pipe that carries it to a treatment plant, where it passes through several stages of treatment before being returned to a stream or river.