Simplify parseLabels method.