Karma is not about it ensuring that good things happen to good PPL and bad things happen to bad people. Karma is the awareness that actions bind a person, physically with their consequences, and mentally, through creating habits and modes of acting that reduce their freedom to do otherwise. Thus human actions and reactions become predictable, like that of inanimate matter, as we loose the ability to act, think and behave with the freedom that we truly possess. If we are bound like inanimate matter, we would be treated by the universe like inanimate matter....she will make us and break us like the mountains and the sea. And THAT is why we suffer. Rocks don't feel happy or suffer as they rise with the mountains or fall into the sea. But we are happy as we rise in status and circumstances and are sad when we fall into poverty or sickness.
Thus Karma Yoga is the skill that is taught on how to act without causing those actions to bind you physically or mentally, to regain and retain your freedom of will from the chain of habits and conditioning. For a skillful one, the making and unmaking that is the cycle of natural life is no longer a cause of either exhuberence or depression. And freedom brings with it the unconditioned joy that is the first step in path of a true spiritual awakening.