Factorize label parsing