Fork from Pttbbs Current rev 5788