David separated the tribes of Eleazar and Ithamar into two different groups. He did this so that these groups could do the duties of work they were given to do. David did this with the help of Zadok and Ahimelech. Zadok was a descendant of Eleazar, and Ahimelech was a descendant of Ithamar.
There were more leaders from Eleazar's family than from Ithamar's. There were 16 leaders from Eleazar's family and there were eight leaders from Ithamar's family.
Men were chosen from each family. They were chosen by throwing lots. Some of the men were chosen to be in charge of the Holy Place. And other men were chosen to serve as priests. All of these men were from the families of Eleazar and Ithamar.
Shemaiah was the secretary. He was Nethanel's son. Shemaiah was from the tribe of Levi. Shemaiah wrote the names of those descendants. He wrote their names in front of King David and these leaders: Zadok the priest, Ahimelech, and the leaders from the families of the priests and of the Levites. Ahimelech was Abiathar's son. Each time they threw the lots a man was chosen, and Shemaiah wrote down that man's name. So they divided the work among groups of men from the families of Eleazar and Ithamar.
These were the groups chosen to serve in the Lord's Temple. They obeyed Aaron's rules for serving in the Temple. The Lord, the God of Israel, had given them to Aaron.
They were chosen for special jobs by throwing lots, like their relatives, the priests. The priests were Aaron's descendants. They threw lots in front of King David, Zadok, Ahimelech, and the leaders of the priests' and Levite families. The older families and the younger families were treated the same when their jobs were chosen.