Refactored admin UI JS