Main program for the pipeline