We study experimentally the role of incentives for the sorting of motivated agents if there are complementaries in production. Participants can join groups in which they earn money for themselves but can also generate charitable donations. The inidvidually generated donations depend on the average donations of the other participants in the group. Consistent with Kosfeld and von Siemens (2009,2011) we find that different incentives facilitate sorting and thereby the production of donations. But our experiment also sheds new light on the interplay of self-selection and cooperative behavior. We find that subjects switch more often between teams than theory predicts. We further find that even selfish individuals contribute more to the charity if they are in the materially less attractive team, but only if self-selection is possible.