Changes for turing off controls during power off plus some cleanup