Added string token algorithm - non re-entrant