added isTRUE checking to takewhile