refactor adminpanel