Added mode functions to pipeline.py