A combination of commits for cleanup and corrections -- take your pick or take 'em all as you wish.

I left off most of my style changes and instead tried to focus on utility.  Feel free to bring over any, all, or none of these commits at your discretion.