revised the pipeline structure to maked it more pythonic