Added logic for checking for AC power and checking for lock button.