Added checks to strtok