change the cost function