Agents Incorporating Identity and Dynamic Teams in Social Dilemmas