Refactor group update code

Simplify some code, reduce the number of nested blocks by bailing out
early instead of using nested if-blocks. Also, move code for searching a
string array into a separate function.

Signed-off-by: Lukas Fleischer <info@cryptocrack.de>
Free string arrays allocated via g_strsplit()

Signed-off-by: Lukas Fleischer <info@cryptocrack.de>