Typo fixes and small code tweaks