David separated the Levites into groups. He did it based on the sons of Levi. The sons were Gershon, Kohath and Merari.