added SampleGroup and refactored