Legitimate punishment, feedback, and the enforcement of cooperation