Modified cost calculation
Merge remote-tracking branch 'origin/master'