Purgatory is the Roman Catholic doctrine on the fate of souls that are in God's saving grace at the time of death and have perfect assurance of salvation but which require, as a matter of divine justice, remaining temporal punishment for forgiven minor sins ("venial" sins) or major sins ("mortal" sins) that were forgiven prior to death. These souls are believed to undergo a final purging after death, and then will enter Heaven. The punishment for sin is twofold: eternal and temporal. The judgment for unforgiven and unrepented sins is hell. When sin is forgiven, the eternal punishment is entirely removed, along with some, or most, or all of the temporal punishment according to the wisdom of a loving God who is both merciful and just. The doctrine of purgatory was formulated at the Councils of Florence and Trent, based on Biblical exegesis. Although Purgatory is not specifically mentioned in the Bible, some theologians cite 1 Corinthians 3:13-15 as a scriptural basis for it; also the example of David 2 Samuel 12:13-23. Those whose transgressions are too great to ever warrant redemption, and those who refuse to repent of sins they have confessed, don't go to Purgatory, but are instead sent straight to Hell after death.