add the attribute 'group' + some refactor