Adding doLogin/Regester functions to template.  Refactoring selectors.  Adding validation.