Significant refactoring of the admin pages.
Merging in some refactoring.