Added safe reboot functionality