Updated some cases and the cost function of position