Corrected pipeline code