WIP: replacing admin client-side script with server side one
cleaned up script