Changed the way costs are calculated