I have a theory: human civilization is at about the peak of what can be achieved, with people in charge. We're just too error-prone and selfish and shortsighted to ever form a larger functioning society.
There are some theories, such as those laid out by Francis Fukuyama in the Origins of Political Order, which postulate that homo sapiens are optimized to form functioning societies of about 120 units. However, certain features have evolved in our species, such as the ability to speak AND write, and form mythologies and stories, which allows our ability to form political societies to exponentially increase. Who's to say we won't keep evolving to find ways to cooperate in ways that were impossible before?
So, replace people in charge with non-humans ? On the bright side the political spectrum can be perfectly defined to the average of the voters. (People would vote on ethical, moral, socialism-liberals problems basically.)
But the code is not going to be easy, or easily accepted ;)