Refactor out tokenize and rm_whitespace.