Is there any easier way to for conditions to calculate costs.