Determining the order of quality control steps