strtok replaced by manual parsing