refactored admin authentication functions