Todd's bug fixes and additions.