Implemented GroupBy

For issue #51.