changed error codes and added usergroup impl and tests