switched group function to return an Option
Updated test cases to reflect change to group function