How did the development of the factory system encourage urbanization?