The cost routine has been added