Historically, Venice solved its lack of natural fresh water through a highly ingenious system of underground cisterns known as "pozzi" (wells) located in almost every public square (campo). Because the city is surrounded by salt water, Venetians built elaborate filtering systems: the entire square was paved with a slight slope leading to stone grates. Rainwater would flow through these grates into a deep pit filled with layers of river sand, which acted as a natural filter. The purified water would then collect in a central brick-lined cistern, where it could be drawn up using a well-head. At its peak, the city had over 6,000 of these wells. The city even had a dedicated "Water Magistrate" to ensure the wells remained uncontaminated. In the late 19th century, this ancient system was replaced by a modern aqueduct—a 5-mile-long underwater pipeline that brings fresh water from the mainland (near the Brenta River) directly to the city's homes and fountains. Today, while the historic well-heads remain as beautiful decorative features of Venice's squares, they are no longer in use, as the city is fully connected to the Italian national water grid.