groupby tests and code passes

Had to make a bunch of changes to the code to get the tests to pass.