Tail rec version of group_consecutive