R. Chaim takes this one step further. Each sin, he writes, causes a flaw in your soul. The punishment that is the consequence of this flaw heals it. Notice that this implies a major statement. We are not judged for what we did, we pay the consequences for who we are .
Man is judged based upon the gap between reality and potential.
Mitzvos were given as vehicles for closing this gap. This also illuminates another complex point. Now we can understand that Hashem is not pinning blame, but rather the damage caused by the wrongful act is correcting itself. An action can be destructive whether we intended it to be or not. When Hagar and Yishmael were kicked out of Avraham's home, and were on the verge of death from thirst in the desert, G-d gave them a well.