Region codes were created by movie studios and distributors in order to control the sales of DVD's from one territory to another and to reduce the risk of piracy. The way it works is that a film is created and distributed in it's own territory by a distributor. Often, a foreign distributor will then buy the rights to distribute the film in other territories. The purchasing distributor's investment is paid off when they release the film in theaters or on DVD in the territories they control, often after the film has already been released on DVD in it's original territory. Six territorial codes numbering 1 to 6 were created and DVD players sold in each territory were meant to play only DVD's of the same region coding. That way, distributors would be guaranteed a return on their investment and would not have their sales undercut by large quantities of import or pirated sales of DVD's.