refactored code that managed admin pages