Minor refactoring, debugging auth issue