Changed a few typos in the file.
Changed typos suggested by RubyMine.
Added else-clause to case/when.
Corrected typo.