added admin function and implemented in plugin
cleaning up in the code