Added more functionality to calc_resistance