cleaned up both the group and sum commands