Merged Reuzel's latest code to thulya's branch, retains thulya fixes.