added code for resistor to work