switch string parsing to a count and slice implementation