minor code cleanup, typo fixes