Cognition, collective intelligence and cultural evolution