Improve power_failure function.