Hydrology has been a subject of investigation and engineering for millennia. For example, about 4000 BC the Nile was dammed to improve agricultural productivity of previously barren lands. Mesopotamian towns were protected from flooding with high earthen walls. Aqueducts were built by the Greeks and Ancient Romans, while the history of China shows they built irrigation and flood control works. The ancient Sinhalese used hydrology to build complex irrigation works in Sri Lanka, also known for invention of the Valve Pit which allowed construction of large reservoirs, anicuts and canals which still function.