Adds groupBy

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