17: factor out tokenizing