Implemented takeWhile and dropWhile