Added code to handle using an external inverter