 Early Kuala Lumpur was a small town that suffered from many social and political problems – the buildings were made of wood and atap (palm frond thatching) that were prone to fire, lack of proper sanitation plagued the town with diseases, and it suffered from a constant threat of flooding. The town became embroil in the Selangor Civil War due in part to the fight for control of revenues from the tin mines. The third Chinese Kapitan of Kuala Lumpur appointed in 1868, Yap Ah Loy, aligned himself with Tengku Kudin, and the rival Chinese gang allied themselves with Raja Mahdi. Kuala Lumpur was captured in 1872 and burnt to the ground, and Yap escaped to Klang. Kuala Lumpur was recaptured in March 1873 when Raja Mahdi forces were defeated with the help of fighters from Pahang. The war and other setbacks, such as a drop in tin prices, led to a slump, furthermore a major outbreak of cholera in late 1870s caused many to flee the town. The slump lasted until late 1879, when a rise in the price of tin allowed the town to recover. In late 1881, the town was severely flooded, following a fire that had destroyed the entire town in January that year. That the town was rebuilt a few times and thrived was due in large part to the tenacity and persistence of Yap Ah Loy. Yap, together with Frank Swettenham who was appointed the Resident in 1882, were the two most important figures of early Kuala Lumpur with Swettenham credited with its rapid growth and development and its transformation into a major urban center.
