Merged trunk changes 796-799 and 801-826 into the new-backend branch.
Authored by: delphidabbler 2010-06-19
Parent: [r828]
Child: [r830]