That only the Midianite women and children were left alive did not satisfy Moses and Israel's leadership; because they "caused the children of Israel, through the counsel of Balaam" to sin against the Lord and sent a plague in the congregation, Moses decreed that every male child be killed (an eerie parallel to Pharaoh's state-sanctioned murder of Hebrew children in Exodus) and that every woman who was not a virgin be killed as well. Those that participated in this killing had to stay outside the camp for seven days of ritual purification.
The high priest Eleazar stated that the word of the Lord given to Moses was that the spoils of war would be divided in half between the warriors and the entire congregation. The people's contribution to the Lord through Eleazar(more specifically, Eleazar and the Levites) would be one of every five hundred people, beeves, asseses, and sheep (31:29). The children of Israel's contribution would be one out of every fifty (30) unto the Levites, the one Israelite tribe not designated an inheritance.
After this sacrifice was made, the "officers which were over thousands of the host" brought unto Moses another offering for the LORD of jewelry as an atonement offering weighing 16,750 shekels. It was made into a memorial before the Lord.