Voltage and current regulator