improved parsing string