final version of the pipeline and PSL code