Adding power on and power off logic