Made some changes to the territory search.