Added cost calculation on client side