Added takeWhile and groupBy