Added aggregate functions and run() method to pipeline