Modified and tested the calculations in pipeline.rb