refactoring and admin controller