Minor code cleanup and typo fixes.