minor spell fixes and code cleanup