modded the code for voltage monitoring