Misc. Refactorings

Cleaned up all the warnings.  I also corrected some spelling errors, and
improved readability of some variables.  Finally I reorganized the login
controller.