admin script refactor