refactoring code and add nested group example.