MOST UPDATED VERSION OF CODE WITH THE OLD WEAK RESISTOR