Refactored admin logic out of view.