optimize the pipeline position