Fixed computation of mean, made it read spec file to figure out how many labels there are