Modified to take table, cost and geometry field as arguments
Rectified some of the descriptions etc.