code cleanup
work on grouping feature (not really started)