Updated #24, TODO B) (fixed cost and integration calculation)