typo fixes, code cleanup