adjusting the costs and implementing a char_weight and order_weight