Split tokenize and parse_tokens calls into their own function to eliminate repitition of cleanup code