refactored admin functionality