Tweaked a few spelling errors and added in some more commentary to the new function