Move user group related functions to a lib file of its own