replaced calls to strpbrk to strtok