Added grouping feature. Closes #4.