rewrite token parsing – fixes #15