Replace usage of strtok with sscanf