Grounds for Cognition (How Goal-guided Behavior Shapes the Mind)