Altruism and reputation: cooperation within groups