extract token and add tests