improve toTokens