The use of steam to power machinery, a major factor in the Industrial Revolution. The earliest steam engine, developed by Thomas Newcomen (1663–1729) by 1712, was used to pump water from Cornish tin mines. Major improvements made by James Watt (1736–1819) greatly increased its efficiency and in 1781 he adapted a steam engine to drive factory machinery, thus providing a reliable source of industrial power. Before this many factories depended on water power and were therefore sited in the countryside near swiftly flowing streams, where transport was difficult; moreover, production was always dependent upon the weather. Although steam engines had none of these disadvantages, they were expensive and only large businesses could afford to install them. Factories were henceforth sited near coal mines and large towns grew up to house the factory workers. The use of steam engines in the textile industry and in other manufacturing processes led to a growth in the size of factories while their application in the 19th century to railways and steamships (thanks largely to the innovations of James Watt) led to both faster and cheaper travel and transport of goods. The steam-hammer (1808) enabled much larger pieces of metal to be worked, while such developments as the steam-driven threshing machine greatly accelerated the harvesting cycle and reduced farmers’ reliance on wind- and water-mills. The direct use of steam engines began to decline in the early 20th century with the development of petrol and diesel engines and the use of steam-driven turbines to generate electricity, an energy source that can be applied more cleanly and easily in industry.