Refactoring admin js