How Change Happens: A theory of philosophy of history, social change and cultural evolution