Within Batavia's walls, the wealthy Dutch built tall houses and canals. Commercial opportunities attracted Indonesian and Chinese immigrants, with the increasing population imposing a burden on the city. During the 18th century, over 60 percent of Batavia's population were slaves working for the Dutch East India Company. Laws protected slaves against overly-cruel actions by their masters; Christian slaves were freed after the death of their masters, and other slaves were allowed to own a store and earn money to buy their freedom.