Implemented takeWhile