Made major modifications for usermanagement to be able to run as a plugin