Anyway, I think the ideas of Heaven and Hell are very far from perfect justice; a mockery of justice really. Imagine a real-life judge: if the person being trailed tells the judge that he really loves him, regardless of the crime, he is let off and, not only is he let off, he's given a reward! That reward being endless pleasure in paradise. However, if the people don't tell him they love him, he sentences them to be tortured forever. Even if they didn't know they could just tell him they loved him, they still get the torture. I imagine lots of them would really despise him for sending people off to be tortured too. How is that perfect justice?
Bringing it back to the main point, nobody will ever deserve to be punished forever, because they can't have done any bad which lasts forever. Meanwhile, you could also say that nobody deserves happiness forever, because everybody does some bad, although, this sounds quite mean to me, if I could give everyone utter happiness forever, I would do it right away.
Now, I'm going to explain how I imagine an afterlife which was truly based on perfect justice would be (and it is a little similar to some ideas of reincarnation really). When you die, all of a sudden you're a foetus again (or maybe even a sperm) and you're actually about to live your life all over again! You get to re-live your childhood! Meet all your old friends! Be reunited with dead family members! etc.! Except, every bad thing that happens to you, and every good things that happens to you, are directly caused by what happened in your previous life. If you were really mean, then in your next run through of life, lots of things will go badly for you. It would go on and on until a 'perfect' person came about, somebody who never did any wrong (and no, consensual sexual explicitries are not immoral) this person would then live there life again, but this time in a perfect world... Heaven basically. But they wouldn't stay there forever, if they're 'perfect' again, there next life will be there too, but if, this time, they acted quite jerkish, then their next life would be a little worse. Like I said, it’s quite like ideas of reincarnation, but without the horrible nightmare of being separated from all your loved ones and having your memory erased so that you forget them entirely!
Feel free to comment if you disagree with me, or you have different ideas! I'm interested in other thoughts.