more admin panel code refactoring