Added the power factor control
A number of other tweaks.