Replace cost_size with new function make_cost_array.