change code to use tokenize.js instead of string splitting