adding support for grouping.
added support for captures.