Major code improvements and bug-fix in login.
Minor code improvements in application-handlebars.