Merged and fixed up, with some new IDT stuff