Refactor add users and groups