Factor out spec reading/parsing code