spelling and code cleanup

* It always irked me when reading misspelled log messages. Fixing various spelling mistakes
* Minor code cleanup -- removed an unused function and simplified some function logic