improved admin code