`prepare_costs` can cause confusion. Suggestion is to refactor to make the logic more clear and maintainable.