refactored check_admin functionality