reorganize and make a pipeline to do the whole process