Implement 'dirty bit' logic

Also do some other changes important for this---see the commit messages for the first two commits
Spelling in comments is enforced?  Man, you guys are rough!  (All right, I'll fix it)