Adds groupBy

This should close #53

@robb please review :-)