finished user management function