Auth bugfixes
Refactoring for validity